<template>
	<Menu :active-name="$route.path" theme="dark" width="auto" :class="menuitemClasses" accordion>
		<div class="logo" style="width: 100%;height: 64px;">
			<!-- <img src="@/assets/logo.png" style="width: 100%;height: 64px;" /> -->
		</div>

		<template v-for="(item,index) in menuList">
			<MenuItem :name="item.path" :to="item.path" v-if="!item.children">
			<Icon :type="item.icon"></Icon>
			<span>{{item.name}}</span>
			</MenuItem>

			<Submenu :name="item.path" v-else style="display: block;">
				<template slot="title">
					<Icon :type="item.icon" />
					<span>{{item.name}}</span>
				</template>
				<MenuItem v-for="(i, idx) in item.children" :key="idx" :name="i.path" :to="i.path">{{i.name}}</MenuItem>
			</Submenu>

		</template>

		<!-- 		<MenuItem name="/" to="/">
			<Icon type="md-home"></Icon>
			<span>角色管理</span>
		</MenuItem>
		<MenuItem name="/jurisdiction" to="/jurisdiction">
			<Icon type="md-share-alt" />
			<span>权限管理</span>
		</MenuItem> -->

	</Menu>
</template>
<script>
	// import menuList from "@/utils/menu.js"
	export default {
		data() {
			return {
				isCollapsed: false,
				type: "",
				menuList: [{
						name: '首页',
						icon: 'md-home',
						path: '/'
					}
				]
			};
		},
		computed: {
			menuitemClasses() {
				return ["menu-item", this.isCollapsed ? "collapsed-menu" : ""];
			},

		},
		methods: {
			changeStr() {

			},


		},
		created() {
			
			console.log(this.$store.state)
			
			var Breadcrumb = JSON.parse(this.astgo.getItem("ys_prj_info_role")) ; //1权限设置路由
			
			console.log(Breadcrumb)
			
			var menu = this.$store.state.menuList;
			var menuList = [];
			
			for(var i = 0,len=menu.length;i<len;i++){
				for(var k = 0,le=Breadcrumb.length;k<le;k++){
					if(menu[i].id==Breadcrumb[k] ){
						this.menuList.push(menu[i])
					}
				}
				
				// if(Breadcrumb.indexOf(menu[i].id)!=-1){
				// 	menuList.push(menu[i])
				// }
			}
			
			console.log(this.menuList)
			// this.menuList.concat(menuList)
			
			// co
			

		}
	};
</script>
<style scoped>
	.menu-item span {
		overflow: visible
	}
</style>
